package day1105.second;

import day1105.common.MyUtil;
import day1105.common.Student;

import java.util.List;

import static day1105.common.MyUtil.printLine;

/**
 * @author Mr.ma
 * @since 2022/11/6 15:44
 **/
public class FindTest {
    public static void main(String[] args) {
        List<Student> studentList = MyUtil.createStudentList();
        studentList.stream().forEach(System.out::println);
        printLine("获取成绩第一的学生");
        Student student = studentList.stream().sorted((s1, s2) -> s2.getScore().compareTo(s1.getScore())).findFirst().get();
        System.out.println("student = " + student);
        printLine("找到二班任意个学生");
        Student student1 = studentList.stream().filter(s -> "二班".equals(s.getClazz())).findAny().get();
        System.out.println("student1 = " + student1);
    }
}
